package com.ruben.simplescaffold;

import cn.hutool.core.lang.SimpleCache;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.Environment;

import java.util.HashMap;

/**
 * 主启动类
 *
 * @author <achao1441470436@gmail.com>
 * @since 2021/5/18 0018 14:52
 */
@Slf4j
@SpringBootApplication
public class SimpleScaffoldApplication {

    public static final SimpleCache<String, Object> POOL = new SimpleCache<>(new HashMap<>());

    public static void main(String[] args) {
        ConfigurableApplicationContext context = SpringApplication.run(SimpleScaffoldApplication.class, args);
        Environment environment = context.getBean(Environment.class);
        String port = environment.getProperty("server.port");
        POOL.put("port", port);
        log.info("端口号：{}", POOL.get("port"));
    }

}
